package com.maxlen.goods.entity.vo;

import com.maxlen.common.valid.AddValid;
import com.maxlen.common.valid.StatusValue;
import com.maxlen.common.valid.UpdateValid;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

@Data
public class AttrVO {

    /**
     * 属性id
     */
    @Null(message = "新增操作id必须为空", groups = AddValid.class)
    @NotNull(message = "修改操作id不能为空", groups = UpdateValid.class)
    private Long attrId;

    /**
     * 属性名
     */
    @NotBlank(message = "属性名不能为空", groups = AddValid.class)
    @Length(min = 1,message = "属性名不能为空", groups = UpdateValid.class)
    @Length(max = 10, message = "属性名不能超过10个字符", groups = {AddValid.class, UpdateValid.class})
    private String attrName;

    /**
     * 是否需要检索[0-不需要，1-需要]
     */
    @NotNull(message = "显示状态不能为空", groups = AddValid.class)
    @StatusValue(val = {0,1},message = "显示状态必须为0或1", groups = {AddValid.class, UpdateValid.class})
    private Integer searchType;

    /**
     * 属性图标
     */
    @NotBlank(message = "属性图标不能为空", groups = AddValid.class)
    @Length(min = 1,message = "属性图标不能为空", groups = UpdateValid.class)
    private String icon;

    /**
     * 是否多选
     */
    @NotNull(message = "多选类型不能为空", groups = AddValid.class)
    @StatusValue(val = {0,1},message = "多选类型必须为0或1", groups = {AddValid.class, UpdateValid.class})
    private Integer valueType;

    /**
     * 可选值列表[用逗号分隔]
     */
    private String valueSelect;

    /**
     * 属性类型[0-销售属性，1-基本属性，2-既是销售属性又是基本属性]
     */
    @NotNull(message = "属性类型不能为空", groups = AddValid.class)
    @StatusValue(val = {0,1},message = "属性类型必须为0或1", groups = {AddValid.class, UpdateValid.class})
    private Integer attrType;

    /**
     * 启用状态[0 - 禁用，1 - 启用]
     */
    @NotNull(message = "启用状态不能为空", groups = AddValid.class)
    @StatusValue(val = {0,1},message = "启用状态必须为0或1", groups = {AddValid.class, UpdateValid.class})
    private Long enable;

    /**
     * 所属分类
     */
    @NotNull(message = "所属分类不能为空", groups = AddValid.class)
    private Long catelogId;

    /**
     * 快速展示【是否展示在介绍上；0-否 1-是】，在sku中仍然可以调整
     */
    @NotNull(message = "快速展示不能为空", groups = AddValid.class)
    @StatusValue(val = {0,1},message = "快速展示必须为0或1", groups = {AddValid.class, UpdateValid.class})
    private Integer showDesc;

    /**
     * 分组 id
     */
    // @NotNull(message = "分组id不能为空", groups = AddValid.class)
    private Long attrGroupId;

}
